<!DOCTYPE html>
<html class="x-admin-sm">

    <head>
        <meta charset="UTF-8">
        <title>欢迎页面-X-admin2.2</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <link rel="stylesheet" href="./css/font.css">
        <link rel="stylesheet" href="./css/xadmin.css">
        <script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="./js/xadmin.js"></script>
      
    </head>
<body>
	<script type="text/javascript" src="./lib/layui/layui.js"></script>
	<div class="layui-form" style="margin-top: 20px">
	<div class="layui-form-item">
		<label class="layui-form-label">姓名</label>
		<div class="layui-input-inline">
			<input type="text" id="sName" name="sName" autocomplete="off"
				class="layui-input" style="width: 190px">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">卡号</label>
		<div class="layui-input-inline">
			<input type="text" id="sCard" name="sCard" autocomplete="off"
				class="layui-input" style="width: 190px">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">密码</label>
		<div class="layui-input-inline">
			<input type="text" id="sCardPassword" name="sCardPassword"
				autocomplete="off" class="layui-input" style="width: 190px">
		</div>
	</div>
	
	
	<div class="layui-form-item">
    <label class="layui-form-label"><span style="color: red;">*</span> 性别</label>
    <div class="layui-input-block" style="width: 190px">
      <select name="sSex" id="sSex" lay-verify="required" >
        <option value=""></option>
        <option >男</option>
        <option >女</option>
      </select>
    </div>
  </div>
	<div class="layui-form-item">
		<label class="layui-form-label">年龄</label>
		<div class="layui-input-inline">
			<input type="text" id="sAge" name="sAge" autocomplete="off"
				class="layui-input" style="width: 190px">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">手机号</label>
		<div class="layui-input-inline">
			<input type="text" id="sPhoneNum" name="sPhoneNum" autocomplete="off"
				class="layui-input" style="width: 190px">
		</div>
	</div>
	<div class="layui-form-item">
    <label class="layui-form-label"><span style="color: red;">*</span> 状态</label>
    <div class="layui-input-block" style="width: 190px">
      <select name="statuses" id=""statuses"" lay-verify="required" >
        <option value=""></option>
        <option >在线</option>
        <option >离线</option>
      </select>
    </div>
  </div>
	<div class="layui-form-item">
		<div class="layui-input-block">
			<button class="layui-btn" id="onc">立即提交</button>
		</div>
	</div>
	</div>
	
	
	<script type="text/javascript">
		
		layui.use('form', function() {
			var form = layui.form;
			var $ = layui.jquery; //引入jquery
			
			  $('#onc').on('click',function(){
			         
		          var url="/insertStudent";
		          var d={
		        	'sName':$("#sName").val(),
		            'sCard':$("#sCard").val(),  
		            'sCardPassword':$("#sCardPassword").val(),
		            'sSex':$("#sSex").val(),
		            'sAge':$("#sAge").val(),
		            'sPhoneNum':$("#sPhoneNum").val(),
		            'statuses':$("#statuses").val()
		          }
		          $.post(url,d,function(res){
		            console.log(res);
		            if(res.success == false){
		              var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
		              parent.layer.close(index); //再执行关闭   
		            }
		          },'json');
		        })
		
		});
	</script>

</body>

</html>